﻿using ReadWriteCsv;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StockAnomalyDetector
{
    //八种异常基类
    abstract class Pattern
    {
        protected int time;
        protected double price;
        protected char BorS;
        protected int quantity;
        protected CsvRow csvRow;

        public Pattern(CsvRow r)
        {
            csvRow = r;
        }

        //每个异常类的Analyze函数实现需要在函数体一开始调用该函数 以简化row[i]的转化
        public void ParseRow()
        {
            time = Convert.ToInt32(csvRow[0]);
            price = Convert.ToDouble(csvRow[1]);
            BorS = Convert.ToChar(csvRow[2]);
            quantity = Convert.ToInt32(csvRow[3]);
        }
       
        public abstract void Analyze();

        public abstract void End(string sourceName);

    }
    class Record
    {
        public string stockcode; // 如SH600000
        public string date; // 如20161010
        public int startTime; // 如93031：9:30:31
        public int endTime; // 如140530：14:05:30
        public override string ToString()
        {
            return string.Format("{0},{1},{2},{3}", stockcode, date, startTime, endTime);
        }
    }


}
